package dbConnection;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;

public class MysqlConnection {
	public static void main(String[] args) throws ClassNotFoundException,
			SQLException {
		Class.forName("com.mysql.jdbc.Driver");
		Connection conn = (Connection) DriverManager
				.getConnection("jdbc:mysql://150.165.93.217/DB_TEST?user=root&password=sqlR00t");
		Statement stm = (Statement) conn.createStatement();
		ResultSet rs = stm.executeQuery("SELECT nome, telefone FROM pessoa");
		while (rs.next()) {
			String nome = rs.getString("nome");
			String telefone = rs.getString("telefone");
			System.out.println("Nome: " + nome + "\tTelefone: " + telefone);
		}
	}
}
